package jmc.core.model.reports;

import jmc.core.model.Pdirch06;
import jmc.util.DateUtil;

public class Irregularidad {
	
	private Pdirch06 pdirch06;
	private String ubicacion;
	private String defecto;
	private int icpart;
	private int icubic;
	private int icgrav;
	private int icacci;
	private int icaudi;
	private String icdesc;
	private String icseri;
	private int icfeic;
	private int ichoic;
	
	public Irregularidad(){
	}
	//P.id.icpart, P.id.icubic, P.icgrav, P.icacci, P.icaudi, P.icdesc
	public Irregularidad(byte icpart, short icubic, short icgrav, int icacci, int icaudi, String icdesc, String ubicacion, String defecto, String icseri, int icfeic, int ichoic){
		this.icpart = icpart;
		this.icubic = icubic;
		this.icgrav = icgrav;
		this.icacci = icacci;
		this.icaudi = icaudi;
		this.icdesc = icdesc;
		this.ubicacion = ubicacion;
		this.defecto = defecto;		
		this.icseri = icseri;
		this.icfeic = icfeic;
		this.ichoic = ichoic;
	}

	public Pdirch06 getPdirch06() {
		return pdirch06;
	}

	public void setPdirch06(Pdirch06 pdirch06) {
		this.pdirch06 = pdirch06;
	}

	public String getUbicacion() {
		return ubicacion;
	}

	public void setUbicacion(String ubicacion) {
		this.ubicacion = ubicacion;
	}

	public String getDefecto() {
		return defecto;
	}

	public void setDefecto(String defecto) {
		this.defecto = defecto;
	}
	public int getIcpart() {
		return icpart;
	}
	public void setIcpart(int icpart) {
		this.icpart = icpart;
	}
	public int getIcubic() {
		return icubic;
	}
	public void setIcubic(int icubic) {
		this.icubic = icubic;
	}
	public int getIcgrav() {
		return icgrav;
	}
	public void setIcgrav(int icgrav) {
		this.icgrav = icgrav;
	}
	public int getIcacci() {
		return icacci;
	}
	public void setIcacci(int icacci) {
		this.icacci = icacci;
	}
	public int getIcaudi() {
		return icaudi;
	}
	public void setIcaudi(int icaudi) {
		this.icaudi = icaudi;
	}
	public String getIcdesc() {
		return icdesc;
	}
	public void setIcdesc(String icdesc) {
		this.icdesc = icdesc;
	}
	public String getIcseri() {
		return icseri;
	}
	public void setIcseri(String icseri) {
		this.icseri = icseri;
	}
	public int getIcfeic() {
		return icfeic;
	}
	public void setIcfeic(int icfeic) {
		this.icfeic = icfeic;
	}
	
	public String getFormatedIcfeic() {
		return DateUtil.getFormatedDataAs400New(String.valueOf(this.icfeic));
	}
	
	public String getFormatedIcfeicExcel() {
		String result = "";
		if (icfeic != 0){
		result = String.valueOf(icfeic);
		result = result.substring(1);
		result = "20" + result;
		}
		return result;
	}
	
	public String getCodigo(){
		
		String clavePart = String.valueOf(this.icpart);
		while(clavePart.length() < 2){
			clavePart = "0" + clavePart;
		}

		String ubicPart = String.valueOf(this.icubic);
		while(ubicPart.length() < 3){
			ubicPart = "0" + ubicPart;
		}

		String ubicGrav = String.valueOf(this.icgrav);
		while(ubicGrav.length() < 3){
			ubicGrav = "0" + ubicGrav;
		}

		return 	clavePart + ubicPart + ubicGrav;
	}
	
	public int getIchoic() {
		return ichoic;
	}
	public void setIchoic(int ichoic) {
		this.ichoic = ichoic;
	}
	
	public String getFormatedIchoic(){
		return DateUtil.getFormatedTimeAs400New(String.valueOf(this.ichoic));
	}
	
}
